#include<stdio.h>
#include<stdlib.h>

//快排的比较函数
int cmp(const void* e1, const void* e2)
{
    return *(int*)e1 - *(int*)e2;
}

int main()
{
    int arr[] = {8, 5, 6, 7, 3, 1, 2, 9};
    int len = sizeof(arr)/sizeof(arr[0]);
    int i = 0;
    for(i = 0 ; i < len; i++)
        printf("%d ", arr[i]);
    printf("\n");

    
    qsort(arr, len, sizeof(int), cmp);

    for(i = 0; i < len; i++)
        printf("%d ", arr[i]);
    printf("\n");

    return 0;
}
